package com.example.finaltool.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.finaltool.model.db.SysConfig;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author dengbw
 */
@Mapper
public interface SysConfigMapper extends BaseMapper<SysConfig> {


    @Insert("INSERT INTO `sys_config`(`label_id`, `config_name`, `config_key`, `config_value`,  `value_type`, `tenant_id`,`sub_tenant_id`) VALUES (#{labelId}, #{configName}, #{configKey}, #{configValue}, #{valueType}, #{tenantId}, #{subTenantId})")
    void save(Long labelId, String configName, String configKey, String configValue, Integer valueType, String tenantId, Long subTenantId);

    @Select("SELECT DISTINCT s.config_value FROM sys_config s WHERE tenant_id = #{corpId} AND config_name='村名称'")
    List<String> getExist(String corpId);
}
